<template>
  <div class="">
    正在定位
  </div>
</template>

<script>
import { geolocation } from '@/utils/map'
export default {
  name: 'Geolocation',
  mounted () {
    // new AMap.Map('container')
    geolocation().then((data) => {
      this.$store.commit('user/SET_LOCATION', data)
      this.$router.replace({
        path: this.$route.query.callbackUrl || '/home'
      })
    }).catch((error) => {
      this.$router.replace({
        path: '/select/location'
      })
      console.log(error, '失败')
    })
  }
}
</script>

<style lang="scss" scoped>

</style>
